package cn.hcbycloud.common.async.service.impl;

import cn.hcbycloud.common.async.service.pool.BaseThreadPoolService;
import cn.hcbycloud.common.async.vo.ThreadPool;

/**
 * @author gaoh
 * @desc 自定义线程池配置实现类
 * @date 2022年02月07日 下午 12:57
 */

public class ThreadPoolServiceImpl extends BaseThreadPoolService {

    @Override
    protected ThreadPool getThreadPool() {
        ThreadPool threadPool = new ThreadPool();
        threadPool.setCorePoolSize(10);
        threadPool.setMaxPoolSize(20);
        threadPool.setQueueCapacity(20);
        threadPool.setKeepAliveSeconds(60);
        threadPool.setThreadNamePrefix(this.getTaskLogInfoPrefix()+"-");
        return threadPool;
    }

    @Override
    public Integer getRedisIndex() {
        return 14;
    }

    @Override
    public String getTaskLogInfoPrefix() {
        return "commonTask";
    }
}